package com.sjhy.plugin.api;

import com.sjhy.plugin.constants.ConfigValue;
import com.sjhy.plugin.tool.HttpUtils;

import java.util.HashMap;
import java.util.Map;

public class TypeMapperGroupApi {
    /**
     * 新增类型映射器组
     *
     * @param groupName 类型映射器组id
     */
    public static String addTypeMapperGroup(String groupName) {
        Map<String, Object> param = new HashMap<>();
        param.put("projectCode", HttpUtils.getProjectCode());
        param.put("groupName", groupName);
        String result = HttpUtils.postJson(ConfigValue.ADD_TYPE_MAPPER_GROUP, param);
        return result;
    }

    /**
     * 删除类型映射器组
     *
     * @param typeMapperGroupid 类型映射器组id
     */
    public static String removeTypeMapperGroup(Integer typeMapperGroupid) {
        Map<String, Object> param = new HashMap<>();
        param.put("projectCode", HttpUtils.getProjectCode());
        param.put("typeMapperGroupid", typeMapperGroupid);
        String result = HttpUtils.postJson(ConfigValue.REMOVE_TYPE_MAPPER_GROUP, param);
        return result;
    }

    /**
     * 创建类型映射
     *
     * @param typeMapperGroupid 类型映射器组id
     */
    public static String addTypeMapper(Integer typeMapperGroupid) {
        Map<String, Object> param = new HashMap<>();
        param.put("typeMapperGroupid", typeMapperGroupid);
        String result = HttpUtils.postJson(ConfigValue.ADD_TYPE_MAPPER, param);
        return result;
    }

    /**
     * 删除类型映射
     *
     * @param typeMapperGroupid 类型映射器组id
     */
    public static String removeTypeMapper(Integer typeMapperGroupid) {
        Map<String, Object> param = new HashMap<>();
        param.put("typeMapperGroupid", typeMapperGroupid);
        String result = HttpUtils.postJson(ConfigValue.REMOVE_TYPE_MAPPER, param);
        return result;
    }
}
